#ifndef DATAQUERYPAGE_H
#define DATAQUERYPAGE_H

#include <QWidget>
//#include "QHeaderView"
//#include "tableviewheader.h"
#include <QStandardItemModel>
#include "Beans/databeans.h"
#include "measureresultpage.h"
#include "QSettings"

namespace Ui {
class DataQueryPage;
}
typedef  struct DATAINFO_TABLE_DATA_T
{
    QString UserID;//用户编号
    QString UserName;//姓名
    QString UserAge;//年龄
    QString UserSex;//性别
    QString MeasureTime;//时间
    QString UserHeight;//身高
    QString UserWeight;//体重
    DataBeans dibs;

}DATAINFO_TABLE_DATA;

typedef QHash<QString, DATAINFO_TABLE_DATA> QHashDataInfoTable;
typedef QHash<QString, DATAINFO_TABLE_DATA>::iterator QHashDataInfoTableIterator;

class DataQueryPage : public QWidget
{
    Q_OBJECT
    enum COLUMN_DATAINFO
    {
        COLUMN_CHECKBOX = 0,
        COLUMN_ID,
        COLUMN_Name,
        COLUMN_Age,
        COLUMN_Sex,
        COLUMN_Height,
        COLUMN_Weight,
        COLUMN_MEASURETIME

    };

public:
    explicit DataQueryPage(QWidget *parent = nullptr);
    ~DataQueryPage();
    void setBg();
    void QueryDataBase();
    void initTableView();
    void setColumnWidth();
    void RefreshTable();
private slots:
    void on_pushButton_Query_clicked();
    void on_tableViewClick(QModelIndex nIndex);
    void on_tableViewDbClick(QModelIndex nIndex);
    void on_tableViewSort(int nColumn);
    void on_tableViewSelectAllCheckBoxClick(Qt::CheckState state);


    void on_bt_return_clicked();

    void on_pushButton_Print_clicked();

    void on_pushButton_Delete_clicked();

private:
    Ui::DataQueryPage *ui;
    QStandardItemModel *m_pTableModel;
//    QHeaderView *m_pTableHeader;
    int m_nCheckedCount;//选中个数
    QHashDataInfoTable m_dataInfoTableHash;
    QList<DataBeans>dibs;
    MeasureResultPage *mrp;
    QString printType;
    QString getTime(QDateEdit *de);

signals:
    void SendUserInfoToResult(UserInfoBeab uib);
};

#endif // DATAQUERYPAGE_H
